<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div style="padding:1rem;">
    <div id="mypid"></div>
    <div id="post-data"></div>
  </div>

  <script>
    fetch('http://localhost:1234/pid').then(res => {
      return res.text()
    })
    .then(d => {
      document.getElementById('mypid').innerHTML = d
    })

    fetch('http://localhost:1234/data', {
      method : 'POST',
      body : 'a=123&b=234',
      headers : {
        'content-type' : 'application/x-www-form-urlencoded'
      }
    }).then(res => {
      return res.text()
    })
    .then(d => {
      document.getElementById('post-data').innerHTML = d
    })

    fetch('http://localhost:1234/data',{
      method : 'DELETE'
    }).then(res => {
      return res.text()
    }).then(d => {
      console.log(d)
    })

  </script>
</body>
</html>